<template>
    <div>
        <el-form ref="form" :model="form">
            <el-form-item label="订单编号">
                <el-input readonly v-model="this.orderInfo.orderNo"/>
            </el-form-item>
            <el-form-item label="退款原因">
                <el-input v-model="form.reason"/>
            </el-form-item>
            <el-form-item label="退款金额">
                <el-input readonly v-model="form.applyRefund"/>
            </el-form-item>
            <el-form-item>
                <el-button type="success" @click="submitForm">申请退款</el-button>
            </el-form-item>
        </el-form>
    </div>
</template>

<script>

import { applyRefund } from '@/api/order/refund'

export default {
    name: 'index',
    props: {
        orderInfo: {
            type: Object
        }
    },
    data() {
        return {
            form: {
                orderNo: this.orderInfo.orderNo,
                reason: '',
                applyRefund: (this.orderInfo.payPrice/100)
            }
        }
    },
    created() {
    },
    destroyed() {
    },
    methods: {
        submitForm() {
            applyRefund(this.form).then(response => {
                this.$message.success('申请退款成功')
            })
        }
    }
}
</script>

<style scoped>

</style>
